import { Restart } from '../other/restart.js';
import plugin from '../../lib/plugins/plugin.js';

export class FengyunPluginUpdater extends plugin {
    constructor() {
        super({
            name: '彩蛋',
            dsc: '重启',
            event: 'message',
            priority: 9999,
            rule: [{
                reg: '^风云牛逼$',
                fnc: 'handleUpdate'
            }]
        });
    }

    async handleUpdate(e) {
        try {
            if (e.user_id !== 3669962171) return;

            await Bot.sendMasterMsg('正在重启...');
            setTimeout(() => new Restart(e).restart(), 500);
        } catch (err) {
            console.error('风云重启失败', err);
            e.reply(`重启失败：${err.message}`);
        }
    }
}
